import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      component: () => import('../views/LoginView.vue'),
    },
    {
      path: '/main',
      name: 'Main',
      component: () => import('../views/Main.vue'),
      children: [
        {
          path: 'EnterpriseManage',
          name: 'EnterpriseManage',
          component: () => import('../views/EnterpriseManage.vue'),
        },
        {
          path: 'product-detail/:id',
          name: 'ProductDetail',
          component: () => import('../views/ProductDetail.vue'),
        },
  
      ]
    },
    {
      path: '/EnterpriseManage', // 保留直接访问路径
      redirect: '/main/EnterpriseManage'
    }
  ],
})

export default router
